package security.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class Knife4jConfig {
    @Bean(value = "defaultApi2")
    public Docket defaultApi() {
        return new Docket(DocumentationType.OAS_30) // 使用OAS_30表示OpenAPI 3标准
                .apiInfo(new ApiInfoBuilder()
                        .title("API文档")
                        .description("这是一个API文档")
                        .version("1.0")
                        .build())
                .select()
                .apis(RequestHandlerSelectors.basePackage("security.controller")) // 设置扫描的包路径
                .paths(PathSelectors.any()) // 设置扫描路径为所有路径
                .build();
    }
}